﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat,java.util.Calendar"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	Calendar cal = Calendar.getInstance();
	cal.add(Calendar.DATE,2); 
	String today = format.format(cal.getTime());
	
	String cardid = (String)request.getParameter("cardid");
	String strTime = (String)request.getParameter("setuptime");
%>
<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">
		<META http-equiv=Content-Type content="text/html; charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link type="text/css" rel="stylesheet" href="include/css/css.css" />
		<link type="text/css" rel="stylesheet" href="include/css/bootstrap-datetimepicker.min.css" />
		<link type="text/css" rel="stylesheet" href="include/iconFont/1.0.8/iconfont.css"/ >
		<link type="text/css" rel="stylesheet" href="include/css/button.css" />
		<link type="text/css" rel="stylesheet" href="include/css/bootstrap.min.css" />
		<link rel="stylesheet" href="include/css/H-ui.css" type="text/css"/>
		<link rel="stylesheet" href="include/css/H-ui.admin.css" type="text/css"/>
	</head>
	<script type="text/javascript">
		var cardid = <%=cardid%>;
		var time2 = <%=strTime%>;
		
		window.onload=function()
		{
			$('.form_datetime').datetimepicker({
		        format: 'yyyy-mm-dd hh:ii',
		        language: 'zh-CN',
		        pickDate: true,
		        pickTime: true,
		        hourStep: 1,
		        minuteStep: 15,
		        secondStep: 30,
		        autoclose: true,
		        pickerPosition:'bottom-left',
		        inputMask: true
		    });
			var tt=new Date(time2).toLocaleString().replace(/\//g, "-"); 
			
			$("#newtime").html(tt);
		}
		
		function changeTime()
		{
			var revalue = $("#setupreason")[0].value;
			if("" == revalue)
			{
				$("#lazytime").hide();
				$("#yicremark").hide();
				$("#newtimes").hide();
			}
			if(1 == revalue)
			{
				$("#lazytime").hide();
				$("#newtimes").hide();
				$("#yicremark").show();
			}
			if(2 == revalue)
			{
				$("#lazytime").show();
				$("#newtimes").show();
				$("#yicremark").hide();
			}
		}
		
		function tijiao()
		{
			
			var revalue = $("#setupreason")[0].value;
			var remark = $("#remark").val();
			var lazytime = $("#yanchi").val();
			
			if('' == revalue)
			{
				layer.alert('请选择未成功原因',{icon:5});
				return;
			}
			
			if(1 == revalue)
			{
				layer.confirm('是否进行异常安装设定？', {
				  btn: ['确定','取消'],skin: 'layui-layer-lan'
				}, function(){
					$.ajax({
						type: "POST",
						url: "CardAction/updateServiceCardState.action",
						dataType: "json",
						data:{"cardid":cardid,"flag":3,"remark":remark,"lazytime":null,"revalue":revalue},
						success: function(res)
						{
							if(res.delflag)
							{
								parent.test('unlockOk');
								
		                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		                        parent.layer.close(index);
							}
							else
							{
								layer.msg('服务卡设置异常失败，请联系作者！', {icon: 2});
							}
						}
					});
				}, function(){
				  layer.msg('已取消操作', {icon: 2});
				});
			}
			
			if(2 == revalue)
			{
				layer.confirm('是否进行延迟安装设定？', {
				  btn: ['确定','取消'],skin: 'layui-layer-lan'
				}, function(){
					$.ajax({
						type: "POST",
						url: "CardAction/updateServiceCardState.action",
						dataType: "json",
						data:{"cardid":cardid,"flag":3,"remark":remark,"lazytime":lazytime,"revalue":revalue},
						success: function(res)
						{
							if(res.delflag)
							{
								parent.test('unlockOk');
								
		                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		                        parent.layer.close(index);
							}
							else
							{
								layer.msg('服务卡设置延迟失败，请联系作者！', {icon: 2});
							}
						}
					});
				}, function(){
				  layer.msg('已取消操作', {icon: 2});
				});
			}
		}
		
	</script>
	<body>
		<div class="panel-body" style="padding-bottom:0px;text-align: left;padding-left: 10px;">
		<div class="panel panel-primary" style="margin-top: 1px">
		<div class="panel-heading" style="text-align: left;">变更内容</div>
		<div id="collapseOne" class="panel-collapse collapse in">
		<div class="panel-body2">
			<p>
				<p>
					<span style="padding-left: 15px">
						<font style="font-size: 12px;text-align: left;color: gray;"><b>未安装成功原因：</b></font>
					</span>
					<span class="select-box inline radius" > 
						<select id="setupreason" name=""setupreason"" class="select" style="width: 100px" onclick="changeTime();">
							<option value="">--请选择--</option>
							<option value="1">异常安装单</option>
							<option value="2">延迟安装单</option>
						</select> 
					</span>
				</p>
				<p style="display: none" id="newtimes">
					<span style="padding-left: 15px">
						<font style="font-size: 12px;text-align: left;color: gray;"><b>原安装时间从：</b></font>
					</span>
					<span> 
						<font id="newtime" style="font-weight: bolder;color: blue;padding-left: 20px;"></font>
					</span>
				</p>
				<p style="display: none" id="lazytime">
					<span style="padding-left: 15px">
						<font style="font-size: 12px;text-align: left;color: gray;"><b>延迟安装时间至：</b></font>
					</span>
					<span class="select-box inline radius" > 
						<input size="16" style="width: 160px;height: 25px;" type="text" value="<%=today %>" readonly class="form_datetime form-control" id="yanchi" name="yanchi"/>
					</span>
				</p>
				<p style="display: none" id="yicremark">
					<span style="padding-left: 15px">
						<font style="font-size: 12px;text-align: left;color: gray;"><b>异常安装单备注：</b></font>
					</span>
					<span class="select-box inline radius" > 
						<input type="text" name="remark" id="remark" placeholder="此处输入备注"
							 class="input-text inline radius" style="width: 150px">
					</span>
				</p> 
			</div>
			</div>
			</div>
				<a href="javascript:;" id="queryUser" style="line-height: 1.6em;margin-left: 165px;"
					class="btn btn-success radius" onclick="tijiao();"><i class="Hui-iconfont">&#xe676;</i>
					确定&nbsp;</a>&nbsp;&nbsp;
			</div>
		<script type="text/javascript" src="include/js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="include/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="include/js/bootstrap-datetimepicker.js"></script>
		<script type="text/javascript" src="include/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
		<script type="text/javascript" src="include/layer/layer.js"></script>
	</body>
</html>